a tool for shared writing and social publishing
at update/reader 54 lines 2.2 kB view raw
1"use client"; 2import { Sidebar } from "components/ActionBar/Sidebar"; 3import { useEntitySetContext } from "components/EntitySetProvider"; 4import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; 5import { HomeButton } from "app/[leaflet_id]/actions/HomeButton"; 6import { Media } from "components/Media"; 7import { useLeafletPublicationData } from "components/PageSWRDataProvider"; 8import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; 9import { ThemePopover } from "components/ThemeManager/ThemeSetter"; 10import { PublishButton } from "./actions/PublishButton"; 11import { PostSettings } from "components/PostSettings"; 12import { Watermark } from "components/Watermark"; 13import { BackToPubButton } from "./actions/BackToPubButton"; 14import { useIdentityData } from "components/IdentityProvider"; 15import { useReplicache } from "src/replicache"; 16 17export function LeafletSidebar() { 18 let entity_set = useEntitySetContext(); 19 let { rootEntity } = useReplicache(); 20 let { data: pub } = useLeafletPublicationData(); 21 let { identity } = useIdentityData(); 22 23 return ( 24 <Media mobile={false} className="w-0 h-full relative"> 25 <div 26 className="absolute top-0 left-0 h-full flex justify-end " 27 style={{ width: `calc(50vw - ((var(--page-width-units)/2))` }} 28 > 29 <div className="sidebarContainer flex flex-col justify-end h-full w-16 relative"> 30 {entity_set.permissions.write && ( 31 <Sidebar> 32 <PublishButton entityID={rootEntity} /> 33 <ShareOptions /> 34 <PostSettings /> 35 <ThemePopover entityID={rootEntity} /> 36 <HelpButton /> 37 <hr className="text-border" /> 38 {pub?.publications && 39 identity?.atp_did && 40 pub.publications.identity_did === identity.atp_did ? ( 41 <BackToPubButton publication={pub.publications} /> 42 ) : ( 43 <HomeButton /> 44 )} 45 </Sidebar> 46 )} 47 <div className="h-full flex items-end"> 48 <Watermark /> 49 </div> 50 </div> 51 </div> 52 </Media> 53 ); 54}